package com.os.opencv.java.chapter6;

import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Size;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

public class BoxFilter {

    public static void main(String[] args) {
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        //读取图像并在屏幕上显示
        Mat src = Imgcodecs.imread("/Users/matt/Pictures/111.jpg");
        HighGui.imshow("src", src);
        HighGui.waitKey(0);

        //对图像进行方框滤波（不归一化）并在屏幕上显示
        Mat dst = new Mat();
        Imgproc.boxFilter(src, dst, -1, new Size(3,3), new Point(-1,-1), false);
        HighGui.imshow("unnormalized", dst);
        HighGui.waitKey(0);

        //对图像进行方框滤波（归一化）并在屏幕上显示
        Imgproc.boxFilter(src, dst, -1, new Size(3,3), new Point(-1,-1), true);
        HighGui.imshow("normlized", dst);
        HighGui.waitKey(0);

        System.exit(0);
    }
}
